#!/bin/bash -e

#yarn build

name=ubuntu@ec2-16-163-29-166.ap-east-1.compute.amazonaws.com

echo 'start'

ssh -i ~/dao.pem ${name} << begin
rm ~/nginx/newp -rf
exit
begin

echo 'upload'

scp -i ~/dao.pem -r ./dist "${name}:~/nginx/newp"

echo 'restart'
ssh -i ~/dao.pem ${name} << begin
cd ~/nginx
sudo docker-compose down && docker-compose up -d
exit
begin
echo 'end'

